// This CSetting class reads an ini file and stores the values
// inside an SVar vector. This is useful to read user's settings.
// It reads a file in this format: name=value
// For example:
//
// [settings]
// width=640
// height=480
// ...

#ifndef SETTINGS_H
#define SETTINGS_H

#include <cstdlib>
#include <iostream>
#include <fstream>
#include <vector>

enum VarTypes {
	NULL_TYPE,
	NUMBER_TYPE,
	STRING_TYPE
};

struct SVar {
public:
	SVar();
	std::string Type;
	std::string Name;
	// Flag for the Value type stored. 0=None,1=Numerical,2=String.
	VarTypes VarType;
	float NValue;
	std::string SValue;
};

class CSettings {
private:
	bool GetSettings(std::string Filename);
	std::vector<std::string> LineVector;
	std::vector<SVar> SettingList;
	int AddNumVar(std::string Type, std::string Name, float Value);
	int AddStrVar(std::string Type, std::string Name, std::string Value);
public:
	CSettings(std::string Filename);
	float GetNValue(std::string Type, std::string Name, float Default);
	std::string GetSValue(std::string Type, std::string Name, std::string Default);
};
#endif

